package com.hjqjl.whapplib.net;

import android.util.ArrayMap;

import com.hjqjl.whapplib.model.GetJoke;
import com.mp5a5.www.library.use.RetrofitFactory;

import io.reactivex.Observable;

public class HttpMethodsNoSingleton {

    private ApiService apiService;

    public HttpMethodsNoSingleton() {
        //涉及到动态切换BaseUrl则用new HttpMethods()，不适用单例模式
        apiService = RetrofitFactory.getInstance().create("https://api.apiopen.top/", ApiService.class);
    }

    public Observable<GetJoke> getJoke(String count) {
        ArrayMap<String, Object> map = new ArrayMap<>();
        map.put("page", "1");
        map.put("count", count);
        map.put("type", "video");
        return apiService.getJoke(map);
//                .map(new RxFunction<>());
    }
}
